package chamster.actions;

import chamster.BaseHamster;

public class GoBackLeftAction<HamsterType extends BaseHamster> 
	implements HamsterAction<HamsterType> {

	public boolean isApplicable(HamsterType hamster) throws Exception {
		if(!hamster.chargeLeft(4)) {
			return false;
		}
		hamster.turnLeft();
		hamster.turnLeft();
		boolean applicaple = new GoFrontLeftAction<BaseHamster>().isApplicable(hamster);
		hamster.turnLeft();
		hamster.turnLeft();
		return applicaple;
	}

	public void run(HamsterType hamster) throws Exception {
		hamster.turnLeft();
		hamster.turnLeft();
		new GoFrontLeftAction<BaseHamster>().run(hamster);
	}

}
